<template>
	<h1>B</h1>
	<div>{{ state.count }}</div>
	<button @click="update">update</button>
	<C />
</template>

<script setup>
// 启动setup实验性语法
import C from '../C/index.vue'
import { reactive, onMounted, defineProps, defineEmit } from 'vue'

// 声明接受props
const props = defineProps({
	name: String,
})
console.log(props)

// 声明接受自定义事件
const emit = defineEmit(['close'])
emit('close')

const state = reactive({
	count: 0,
})

const update = () => {
	state.count++
}

onMounted(() => {
	console.log('onMounted~~')
})
</script>

<style></style>
